package truef.service.customer.service;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import edu.zut.cs.software.base.service.GenericGenerator;
import truef.customer.domain.Coupon;
import truef.customer.domain.Customer;
import truef.service.customer.service.CouponManager;
import truef.service.customer.service.CustomerManager;

public class user_EntityGenerator extends GenericGenerator{

	@Autowired
	CouponManager couponManager;
	
	@Autowired
	CustomerManager customerManager;
	
	@Test
    public void gen_customer(Customer us) {
        for (int i = 0; i < 2; i++) {
        	Customer u = new Customer();
            u.setName("customer_" + i);
            this.customerManager.save(u);
            for (int j = 0; j < 2; j++) {
            	Customer customer = new Customer();
            	customer.setName("customer_" + i + "_" + j);
            	//record.setParent(r);
                u = this.customerManager.save(customer);
                this.gen_customer(u);
            }
        }
    }
	
	public void gen_coupon(Coupon c) {
		for (int i = 0; i < 2; i++) {
            Coupon coupon = new Coupon();
            coupon.setName("couponName_" + i);
            this.couponManager.save(coupon);
        }
	}

}
